package cn.edu.scau.cmi.liweihang.abstractFactory.domainProduct;

import cn.edu.scau.cmi.liweihang.abstractFactory.domainMeat.KindOfMeat;
import cn.edu.scau.cmi.liweihang.abstractFactory.factory.AbstractFactory;
import cn.edu.scau.cmi.liweihang.abstractFactory.factory.AonongFactory;
import cn.edu.scau.cmi.liweihang.abstractFactory.factory.TianBangFactory;
import cn.edu.scau.cmi.liweihang.abstractFactory.factory.WensFactory;
import javafx.fxml.FXML;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextArea;

public class Control {
    @FXML
	private ComboBox comboBox1,comboBox2;
	@FXML
	private TextArea textarea;
	
	private AbstractFactory factory=null;
	
	private KindOfMeat meat=null;
	
	public void production() {
		String brand=(String) comboBox1.getValue();
		String kind=(String) comboBox2.getValue();
		System.out.println(brand);
		System.out.println(kind);
		factory=factory.getFactory(brand);	
		switch(kind) {
		case"Beef":
			meat=factory.cookBeef();break;
		case"Chicken":
			meat=factory.cookChicken();break;
		case"Pork":
			meat=factory.cookPork();break;
		}		
		System.out.println(meat.product());
        textarea.appendText(meat.product()+"\n");
	}
}
